<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class LogisticsTemplate extends Model
{
    protected $fillable = [
        'name',
        'type',
        'address_ids',
        'open_piece',
        'first_piece',
        'first_piece_price',
        'other_piece',
        'other_piece_price',
        'logistics_id',
        'open_weight',
        'first_weight',
        'first_weight_price',
        'other_weight',
        'other_weight_price',
        'open_volume',
        'first_volume',
        'first_volume_price',
        'other_volume',
        'other_volume_price',
    ];

    const TYPE_DEFAULT_ADDRESS = 'default_address'; // 默认地区
    const TYPE_DESIGNATED_ADDRESS = 'designated_address'; // 指定地区

    public static $typeMap = [
        self::TYPE_DEFAULT_ADDRESS => '默认地区',
        self::TYPE_DESIGNATED_ADDRESS => '指定地区'
    ];

    protected $casts = [
        'open_piece' => 'boolean',
        'open_volume' => 'boolean',
        'open_weight' => 'boolean',
        'address_ids' => 'array'
    ];
}
